package com.ruoyi.basicsys.domain;

import com.fasterxml.jackson.databind.util.BeanUtil;
import com.ruoyi.basicsys.Ro.HouseholdRegisterRo;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.pojo.constant.RConst;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 住户管理对象 basic_household
 * 
 * @author ruoyi
 * @date 2024-07-25
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BasicHousehold extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 住户id */
    private Long id;

    /** 住户名字 */
    @Excel(name = "住户名字")
    private String householdName;

    /** 性别 */
    @Excel(name = "性别")
    private String sex;

    /** 电话号码 */
    @Excel(name = "电话号码")
    private String phone;

    /** 微信 */
    @Excel(name = "微信")
    private String wechat;

    /** 住户密码 */
    @Excel(name = "住户密码")
    private String password;

    /** 小区id */
    @Excel(name = "小区id")
    private Long communityId;

    /** 小区名字 */
    @Excel(name = "小区名字")
    private String communityName;

    /** 楼栋id */
    @Excel(name = "楼栋id")
    private Long buildingId;

    /** 楼层名字 */
    @Excel(name = "楼层名字")
    private String buildingName;

    /** 地址 */
    @Excel(name = "地址")
    private String address;

    /** 状态：1为正常 0为异常 */
    @Excel(name = "状态：1为正常 0为异常")
    private Long nucleicAcidStatus;

    /** 用户状态: 0为管理员 1为普通住户 */
    @Excel(name = "用户状态: 0为管理员 1为普通住户")
    private String householdStatus;

    /** 身份证 */
    @Excel(name = "身份证")
    private String identityCard;
    //任务人数
    private Integer countHousehold;


    public static BasicHousehold HouseholdRegisterRoToBasicHousehold(HouseholdRegisterRo householdRegisterRo){
        BasicHousehold basicHousehold = new BasicHousehold();
        //把RO转换为basicHousehold
        BeanUtils.copyProperties(householdRegisterRo,basicHousehold);
        //设置初始默认密码为123456
        basicHousehold.setPassword(RConst.Str.PASSWORD);

        //状态默认为正常  1为正常 0为异常
       // basicHousehold.setHouseholdStatus(RConst.Str.NUM_1);
        return basicHousehold;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("householdName", getHouseholdName())
            .append("sex", getSex())
            .append("phone", getPhone())
            .append("wechat", getWechat())
            .append("password", getPassword())
            .append("communityId", getCommunityId())
            .append("communityName", getCommunityName())
            .append("buildingId", getBuildingId())
            .append("buildingName", getBuildingName())
            .append("address", getAddress())
            .append("nucleicAcidStatus", getNucleicAcidStatus())
            .append("remark", getRemark())
            .append("householdStatus", getHouseholdStatus())
            .append("identityCard", getIdentityCard())
            .toString();
    }
}
